<template>
	<view style="display: flex;flex-direction: column; width: 100%;">
		<view style="margin: 20rpx 10rpx 20rpx 10rpx; min-height: 550rpx;">
			<!-- #ifdef MP-WEIXIN -->
			<ad v-if="showad" :unit-id="config.FullVideoID" ad-type="video" ad-theme="white"></ad>
			<!-- #endif -->
		</view>
		<!-- 		<view
			style="margin: 10rpx 20rpx 10rpx 20rpx; padding: 20rpx; border: 2px solid #888; border-radius: 10rpx; overflow: hidden; min-height: 2.2rem;">
			<uv-text :text="homeurl" type="info" wordWrap="anywhere" @click="copytext"></uv-text>
		</view> -->
		<view
			style="margin: 10rpx 20rpx; padding: 20rpx; border: 2px solid #888; border-radius: 10rpx; overflow: hidden;">
			<uv-input placeholder="请输入链接" border="none" v-model="homeurl"></uv-input>
		</view>
		
		<view>
			<view style="margin: 20rpx 20rpx 10rpx 20rpx;">
				<uv-button style="width: 100%;" customStyle="height: 150rpx;"  type="success" size="large" @click="jmp" text="打开任务链接"></uv-button>
			</view>
			<view style="margin: 20rpx 20rpx">
				<uv-button style="width: 100%;" plain type="primary " @click="copytext" text="复制到文件传输助手打开"></uv-button>
			</view>
		</view>
		<!-- 		<uv-row>
			<uv-col span="6">
				
			</uv-col>
			<uv-col span="6">
				
			</uv-col>

		</uv-row> -->
	</view>
</template>

<script setup>
	import {
		onLoad,
		onShow
	} from '@dcloudio/uni-app'
	import config from '../../common/config.js';
	import {
		nextTick,
		onMounted,
		ref
	} from 'vue';
	let showad = ref(false)
	let homeurl = ref("");
	onLoad((op) => {
		if (op.url != null) {
			let url = decodeURIComponent(op.url)
			url = decodeURIComponent(url)
			homeurl.value = url
		}
		showad.value = true
	})

	async function copytext() {
		uni.setClipboardData({
			data: homeurl.value
		})
	}

	async function jmp() {
		// #ifdef MP-WEIXIN
		if (homeurl.value != "") {
			wx.navigateToMiniProgram({
				shortLink: homeurl.value,
				fail: (res) => {
					console.log(res)
					uni.showToast({
						title: "打开失败,请复制到文件传输助手打开",
						icon: "none"
					})
				}
			})
		}
		// #endif
	}
</script>

<style>
	page {
		display: flex;
		flex-direction: column;
		width: 100%;
		height: 100%;
		background-color: #FEFEFE;
	}
</style>